HW4-final

Author

Kristin Art (she/her)

Description

I plan to pursue option 2 for HW #4. My research question has changed to the following:

How does potential supply and demand of green hydrogen fuel in 2030 vary across space in California?

Within this overarching question, I will answer the following questions using my infographic components:

  1. What is the spatial distribution of potential green hydrogen supply and demand for hydrogen fuel from the transportation sector in 2030?

  2. How does potential supply and demand for hydrogen fuel compare within and between regions in 2030? Will individual regions be able to produce enough supply to meet local demand amounts?

  3. Will individual counties in Southern California be able to produce enough supply to meet local demand amounts in 2030? Which counties will be net importers or net exporters of hydrogen fuel?

I have decided to include data from my MESM Group Project (GP) for this assignment. I have used output data from our GP that contains the following variables:

  • demand_h2_kg_d, which is the amount of hydrogen in kg per day that will be demanded at each projected demand location. These values correspond to point geometries for potential hydrogen re-fueling stations that were developed through a comprehensive study by the UC Davis Institute of Transportation Studies (Fulton et al. 2023).

  • supply_h2_kg_d, which is the amount of hydrogen in kg per day that can be produced through wind- or solar-powered electrolysis. These values correspond to point geometries that my GP team developed by identifying renewable resource potential, excluding area unsuitable for renewable development, and siting electrolyzer (hydrogen production technology) facilities through an optimization model.

I aggregated these two variables into county and regional totals for plotting purposes by spatially joining the data with county geometries from the US Census Bureau.

Visualization Resources

Below are two visualizations I might borrow from for this assignment.

The first is a visualization created by Cedric Scherer that I found here. I like the layout of this visualization and the use of annotations alongside the visuals. I also like that he colored certain words and used color on the plots to emphasize them. I may adapt from his code to figure out how to size the graphics, add annotations, etc.

The second is a visualization created by Dan Oehm that I found here. I like how he annotated with text and may borrow from his code to understand how to add and position annotations. He also used patchwork, included custom fonts, and labeled histogram bars, which I would like to do for one of my figures as well.

Draft Infographic

Here is a rough drawing of the infographic I would like to make. The actual layout of the subplots and text will probably change based on what the components look like after being coded.

Below are drafts of the infographic’s subplots:

## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##                                    Setup                                 ----
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# .........................load libraries.........................
library(tidyverse)
library(here)
library(sf)
library(patchwork)
library(ggspatial)
library(cowplot)
library(plotly)
library(ggpubr)
library(gridExtra)
library(RColorBrewer)
library(scales)
library(paletteer)
library(ggtext)
library(ggpattern)
library(showtext)
library(ggh4x)
library(gghighlight)

library(MetBrewer)
library(scico)


# ..........................load fonts...........................
font_add_google(name = "Montserrat", family = "mont")
showtext_auto()

# .........................define color palettes.........................
# define color palettes, from coolors
# n = 4
pal_regions <- c(
  "#64865B", "#664C5E", "#4F7D7A", "#D19180"
)

# n = 8
pal_regions2 <- c(
  "#5B656C", "#664C5E",
  "#719B82", "#4F7D7A",
  "#86A77D", "#64865B",
  "#9C6F6F", "#D19180"
)

# n = 8 ordered for half circle plots. should probably  write a dictionary for region/ type if use half circle area plots
pal_regions3 <- c(
  "#5B656C", "#719B82",
  "#86A77D", "#9C6F6F",
  "#664C5E", "#4F7D7A",
  "#64865B", "#D19180"
)

# ..........................import data...........................
# load CA polygon
ca_sf <- spData::us_states %>%
  filter(GEOID == "06") %>%
  st_transform(crs = "EPSG:4326")

# load ca county outlines
counties_sf <- read_sf(here::here("data/census/tl_2022_us_county/tl_2022_us_county.shp")) %>%
  filter(STATEFP == "06") %>% # FIPS code for CA is 06
  janitor::clean_names() %>%
  dplyr::select(countyfp, geoid, name, namelsad, geometry) %>%
  st_transform(crs = "EPSG:4326")

# load transportation demand
demand_mod <- st_read(here::here("data/fueling_demand_2030/fueling_demand_2030.shp"), quiet = TRUE)

# load combined demand electrolyzer outputs from script 05
elect_demand <- st_read(here::here("data/electrolyzers_output/electrolyzer_demand_limited_baseline_uncapped.geojson"), quiet = TRUE) ## THIS INCLUDES GEOMS OF THE ELECTROLYZER POINTS

# load combined renewables electrolyzer outputs from script 05
elect_renewables <- st_read(here::here("data/electrolyzers_output/electrolyzer_renewables_limited_baseline_uncapped.geojson"), quiet = TRUE) ## THIS INCLUDES GEOMS OF THE ELECTROLYZER POINTS

# load combined renewables electrolyzer outputs from script 05
elect_renewables2 <- st_read(here::here("data/electrolyzers_output/electrolyzer_renewables_renewablegeoms_limited_baseline_uncapped.geojson"), quiet = TRUE) ## THIS INCLUDES GEOMS OF THE RENEWABLE POINTS

## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##                          Data wrangling / cleaning                       ----
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# .........................tidy and combine data.........................
# spatially join county geoms to demand and supply data ----
demand_counties <- demand_mod %>% st_join(counties_sf, join = st_intersects)
supply_counties <- elect_renewables2 %>% st_join(counties_sf) # for supply geoms based on renewables
# supply_counties <- elect_renewables %>% st_join(counties_sf) #for supply geoms based on electrolyzers

# sum county-wide hydrogen in each df ----
h2_demand_counties <- demand_counties %>%
  st_drop_geometry() %>% # drop geometries
  group_by(name) %>% # name = county name
  summarize(demand_h2_kg_d = sum(fueling)) # sum the amount of demand (kg/ d) within each county

h2_supply_counties <- supply_counties %>%
  st_drop_geometry() %>% # drop geometries
  group_by(name) %>% # name = county name
  summarize(supply_h2_kg_d = sum(potential_h2_kg_d)) # sum the amount of supply (kg/ d) within each county

# combine demand and supply data ----
h2_counties <- h2_demand_counties %>%
  full_join(h2_supply_counties, by = "name") %>% # join by county name
  mutate(across(everything(), ~ ifelse(is.na(.), 0, .))) %>% # replace NAs
  rename("county" = "name") %>% # rename name column to county
  mutate(difference = abs(supply_h2_kg_d - demand_h2_kg_d)) %>% # calculate difference between supply and demand amounts
  arrange(desc(difference)) # arrange in order based on difference


# .........................define state regions.........................
# define counties within each state region. based on https://ww2.arb.ca.gov/lcti-central-region
coastal_ca_counties <- c("Alameda", "Contra Costa", "Marin", "Monterey", "Napa", "San Benito", "San Francisco", "San Mateo", "San Luis Obispo", "Santa Clara", "Santa Cruz", "Sonoma", "Solano")

northern_ca_counties <- c("Alpine", "Amador", "Butte", "Calaveras", "Colusa", "Del Norte", "El Dorado", "Glenn", "Humboldt", "Lake", "Lassen", "Mendocino", "Modoc", "Nevada", "Placer", "Plumas", "Sacramento", "Shasta", "Sierra", "Siskiyou", "Sutter", "Tehama", "Trinity", "Yolo", "Yuba")

central_ca_counties <- c("Fresno", "Inyo", "Kern", "Kings", "Madera", "Mariposa", "Merced", "Mono", "San Joaquin", "Stanislaus", "Tulare", "Tuolumne")

southern_ca_counties <- c("Imperial", "Los Angeles", "Orange", "Riverside", "San Bernardino", "San Diego", "Santa Barbara", "Ventura")

# add regions and difference groupings to df ----
h2_counties <- h2_counties %>%
  mutate(
    region = case_when(
      county %in% northern_ca_counties ~ "Northern CA",
      county %in% southern_ca_counties ~ "Southern CA",
      county %in% central_ca_counties ~ "Central CA",
      county %in% coastal_ca_counties ~ "Coastal CA"
    ),
    difference_description = case_when(
      (supply_h2_kg_d - demand_h2_kg_d) > 0 ~ "more supply",
      (supply_h2_kg_d - demand_h2_kg_d) < 0 ~ "more demand"
    )
  )

# add county geometries back to full df ---
h2_counties_sf <- left_join(counties_sf, h2_counties, by = c("name" = "county")) %>%
  mutate(region = ifelse(name == "San Francisco", "Northern CA", region))


## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##                             Data visualization                           ----
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Demand Map

# plot demand sites and amounts ----
p1 <-
  ggplot() +
  geom_sf(data = ca_sf) +
  geom_sf(data = h2_counties_sf, aes(fill = region, shape = "Demand Center"), alpha = 0.5, color = "transparent") +
  scale_fill_manual(
    values = pal_regions,
    breaks = c("Northern CA", "Central CA", "Coastal CA", "Southern CA"),
    guide = "none"
  ) +
  geom_sf(data = elect_demand, aes(size = demand_capacity_served), col = "grey40", alpha = 0.7) +
  scale_size(range = c(2, 5)) +
  geom_sf(data = elect_renewables2, aes(shape = "Production Site"), col = "black", size = 2.5, alpha = 0.7) +
  labs(
    size = "Demand (kg/ day)",
    shape = "Location Type",
    title = "Spatial Distribution of Hydrogen Supply and Demand in 2030", 
    # subtitle = "Electrolytic Hydrogen Production and Transportation Sector Demand"
    subtitle = "Supply of Electrolytic Hydrogen and Demand from Transportation Sector"
  ) +
  scale_x_continuous(limits = c(-125, -114)) +
  theme_minimal() +
  theme(
    plot.title = element_text(size = 14, hjust = 0.5, family = "mont"),
    plot.title.position = "plot",
    plot.subtitle = element_text(size = 10, hjust = 0.5, color = "grey50", family = "mont"),
    legend.position = c(0.73, 0.79),
    legend.background = element_rect(fill = "grey97", color = "grey80"),
    panel.grid = element_blank(),
    axis.title = element_blank(),
    axis.text = element_blank(),
    legend.title = element_text(size = 11, family = "mont", face = "bold"),
    legend.text = element_text(size = 10, family = "mont")
  ) +
  annotate(
    geom = "label",
    x = c(-123.8, -117.8, -122.1, -121.1),
    y = c(39.6, 36.4, 35.9, 33.3),
    label = c("Northern CA", "Central CA", "Coastal CA", "Southern CA"),
    color = pal_regions,
    size = 5,
    color = "black",
    family = "mont",
    fontface = "bold",
    label.size = 1
  ) +
  guides(size = guide_legend(order = 2), shape = guide_legend(order = 1, override.aes = list(fill = c("grey50", "black"))))

print(p1)

Regional Supply/ Demand Histogram (Vertical)

# pivot longer ----
h2_regions_long <- h2_counties %>%
  rename(Demand = demand_h2_kg_d, Production = supply_h2_kg_d) %>%
  pivot_longer(cols = Demand:Production, values_to = "count", names_to = "type") %>%
  mutate(
    x = case_when(
      type == "Demand" ~ 1,
      type == "Production" ~ 2
    ),
    region = as.factor(region)
  ) %>%
  group_by(region, type) %>%
  summarize(count = sum(count))

# plot S & D dodged bar chart
p2 <-
  h2_regions_long %>%
  mutate(
    region = factor(region, levels = rev(c("Coastal CA", "Northern CA", "Central CA", "Southern CA"))), # ordered by highest demand
    type = factor(type, levels = rev(c("Production", "Demand")))
  ) %>%
  ggplot(aes(x = region, y = count, pattern = type)) +
  geom_col_pattern(fill = pal_regions2, position = "dodge", alpha = 0.9, color = "grey0") +
  scale_pattern_manual(values = c("wave", "none")) +
  scale_pattern_fill_manual(values = c("black", "white")) +
  scale_y_continuous(expand = c(0.02, 0), labels = scales::label_number(scale_cut = cut_short_scale())) +
  expand_limits(y = max(7000000)) +
  geom_text(aes(label = (c(
    "2.5M", "5.9M",
    "1.3M", "1.9M",
    "1.9M", "4.9M",
    "6.1M", "1.8M"
  ))), color = "black", vjust = -0.9, hjust = 0.5, position = position_dodge(width = 0.9), family = "mont", fontface = "bold") +
  labs(y = "", x = "", title = "Daily Hydrogen Production and Demand by Region (2030)") + # Hydrogen (kg/day)
  theme_minimal() +
  theme(
    axis.title = element_text(size = 14, family = "mont"),
    axis.title.x = element_blank(),
    plot.title = element_text(size = 16, hjust = 0.5, family = "mont", face = "bold", margin = margin(b = 10)),
    plot.title.position = "plot",
    # plot.subtitle = element_text(size = 14, hjust = 0.5, color = "grey50"),
    legend.direction = "horizontal",
    legend.position = "top",
    legend.box.just = "center",
    # legend.justification = "center",
    legend.title = element_blank(),
    panel.grid = element_blank(),
    axis.text.x = element_text(size = 12, family = "mont"),
    axis.text.y = element_blank(),
    legend.text = element_text(size = 12, family = "mont")
  ) +
  guides(fill = guide_legend(reverse = TRUE))

print(p2)

Southern CA Counties Differences Dumbbell Plot

# define function to rewrite values in shorthand format ----
custom_number_format <- function(x) {
  ifelse(x >= 1e6,
    gsub(" ", "", sprintf("-%sM", format(round(x / 1e6, 1), nsmall = 1, big.mark = ""))),
    gsub(" ", "", sprintf("-%sk", format(round(x / 1e3), big.mark = "")))
  )
}

# tidy data labels and values for dotted line in next plot
socal_counties <- h2_counties %>%
  filter(county %in% southern_ca_counties) %>%
  mutate(
    difference_abbr = (custom_number_format(difference)),
    difference_abbr = ifelse(difference_description == "more supply", "+282k", difference_abbr),
    dotted_line = ifelse(difference_description == "more supply", demand_h2_kg_d, supply_h2_kg_d)
  )

# plot S&D differences between socal counties dumbbell ----
p3 <- socal_counties %>%
  ggplot() +
  geom_segment(aes(x = 0, xend = dotted_line, y = reorder(county, difference), yend = reorder(county, difference)), alpha = 0.4, linetype = "dotted", linewidth = 0.7) +
  geom_segment(aes(x = demand_h2_kg_d, xend = supply_h2_kg_d, y = reorder(county, difference), yend = reorder(county, difference), size = "Difference"), alpha = 0.4, linewidth = 1.5, color = "#A05F54") +
  geom_text(
    aes(
      x = (demand_h2_kg_d + supply_h2_kg_d) / 2,
      y = reorder(county, difference),
      # color = "Difference",
      label = difference_abbr,
      family = "mont",
    ),
    position = position_nudge(y = 0.4),
    show.legend = FALSE,
    size = 3
  ) +
    geom_point(aes(x = supply_h2_kg_d, y = reorder(county, difference), shape = "Production"), size = 3, fill = "#D19180", color = "grey20") +
  geom_point(aes(x = demand_h2_kg_d, y = reorder(county, difference), shape = "Demand"), size = 4, fill = "#9C6F6F", color = "grey20") +
  scale_shape_manual(values = c("Production" = 24,"Demand" = 21), breaks = c("Production", "Demand")) +
  scale_x_continuous(labels = scales::label_number(scale_cut = cut_short_scale())) + # , position = "top" moves x axis to top of plot
  labs(y = "", x = "Hydrogen (kg/ day)", subtitle = "Difference between Daily Hydrogen Production and \nDemand in Southern California Counties (2030)", title = 
         "In Southern California, most individual counties will be daily net consumers of 
       \nH2 in 2030. This means distribution of hydrogen from surrounding counties 
       \nmay play an important role. H2 distribution can be one of the most costly 
       \ncomponents of the supply chain and trucking of liquid H2 is expected to be the 
       \nprimary mode in 2030. This could also mean that Southern California will rely 
       \non H2 from other production pathways that have a higher environmental 
       \nfootprint than carbon-free electrolytic H2.") +
  theme_minimal() +
  theme(
    axis.title = element_text(size = 8, family = "mont"),
    axis.title.x = element_text(family = "mont", margin = margin(t = 8)),
    axis.text = element_text(size = 8, family = "mont"),
    axis.text.y = element_text(size = 8, family = "mont"),
    plot.title = element_text(size = 8, hjust = 0, family = "mont",  margin = margin(b = 20)),
    plot.title.position = "plot",
    plot.subtitle = element_text(size = 10, hjust = 0.5, family = "mont", face = "bold", margin = margin(b = 10)),
    legend.direction = "horizontal",
    legend.position = "top",
    legend.justification = c(-2.5,0),
    legend.title = element_blank(),
    legend.text = element_text(size = 8, family = "mont", face = "bold"),
    plot.margin = margin(t = 20, b = 20, r = 20, l = 20),
    panel.grid = element_line(color = "grey97"),
    #panel.background = element_rect(fill = "white"),
    plot.background = element_rect(colour = "black", fill = alpha("#9C6F6F",0.3),size=5),
    panel.grid.major.y = element_blank(),
    panel.grid.major.x = element_line(linewidth = 0.3),
    legend.spacing.x = unit(-0, "lines"),
    legend.margin = margin(-5, -5, 0, 0)
  ) +
  guides(
    size = guide_legend(order = 1, override.aes = list(x = -5, y = 1)),
    shape = guide_legend(order = 2, override.aes = list(values = c(), fill = c("#D19180","#9C6F6F"), shape = c(24, 21)))) +
  coord_cartesian(clip = "off")+
  annotate("label", x = 1250000, y = 2, label = "Ventura is the only county \nthat will produce extra H2", size = 3, family = "mont") +
  annotate("label", x = 1500000, y = 4.3, label = "LA and Santa Barbara \ncounties will not produce \nany electrolytic H2", size = 3, family = "mont")+
  annotate(
    geom = "curve",
    x = 750000, xend = 330000,
    y = 1.35, yend = 1.8,
    curvature = -0.7, 
    arrow = arrow(length = unit(0.3, "cm")),
    alpha = 0.5
  )
# +
#   annotate("rect", xmin = -1000000, xmax = 2250000, ymin = -3, ymax = 10, colour = "black", fill = "transparent")

print(p3)

Infographic (Draft)

## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##                             Finalize Subplots                           ----
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# .........................finalize map.........................
p1_final <-
  p1 +
  theme(
    plot.margin = margin(t = 0, r = 500, b = 0, l = -20, unit = "pt")
  ) +
  inset_element(p3, left = 0.5, bottom = 0.15, right = 0.86, top = 0.95, align_to = "full") 
 
p1_final

# .........................finalize bar plot.........................
text <- tibble(
  x = 0, y = 0,
  label = "<p>Both production and demand for hydrogen fuel (H2) in California are expected to increase in coming years. Here we explore estimates for electrolytic H2 supply and transportation sector demand in 2030.<p><br>
  The transportation sector is expected to be the earliest adopter for use in light-, medium-, and heavy-duty fuel cell electric vehicles (FCEVs). Demand is concentrated along major highways and within densely populated neighborhoods.<p><br>
  Production of green H2 through electrolysis is constrained to areas with sufficient wind and solar resources, water availability, and favorable permitting and regulation policies.<p><br>
  In 2030, Southern California will have the highest daily demand for H2 in transportation uses. Southern California will not be able to supply enough electrolytic H2 to meet its demand, which means the region may have to rely on importing (which can be costly) or alternative sources of H2 (which are not all renewable).<p><br>
  Northern, Central, and Coastal California will be able to produce enough electrolytic H2 to meet in-region daily demand, with excess available for transport or storage.<p>"
)

bg = "white"

sub <- ggplot(text, aes(x = x, y = y))+
  geom_textbox(aes(label = label), family = "mont", width = unit(30, "lines"), box.color = bg, fill=bg)
sub

# sub <- ggplot(text, aes(x = x, y = y)) +
#   geom_textbox(
#     aes(label = label),
#     box.color = bg, fill=bg, width = unit(10, "lines"),
#     family=font, size = 3, lineheight = 1
#   ) +
#   coord_cartesian(expand = FALSE, clip = "off") +
#   theme_void() +
#   theme(plot.background = element_rect(color=bg, fill=bg))

p2_final <- sub/ p2
print(p2_final)

p2_final <-
  p2 +
  # annotate("text", x = -0.25, y = 30000000, label = title, family = "mont", size = 36, lineheight = 0.35, hjust = 0, vjust = 1, fontface = "bold") +
  annotate("text",
    x = 0.5, y = 70000000, label =
      "Both production and demand for hydrogen
fuel (H2) in California are expected to
increase in coming years. Here we explore
estimates for electrolytic H2 supply
and transportation sector demand in 2030.

The transportation sector is expected
to be the earliest adopter for use in
light-, medium-, and heavy-duty fuel
cell electric vehicles (FCEVs). Demand
is concentrated along major highways and
within densely populated neighborhoods.

Production of green H2 through
electrolysis is constrained to areas
with sufficient wind and solar resources,
water availability, and favorable
permitting and regulation policies.

In 2030, Southern California will have the
highest daily demand for H2 in transportation
uses. Southern California will not be able to
supply enough electrolytic H2 to meet its
demand, which means the region may have to rely
on importing (which can be costly) or alternative
sources of H2 (which are not all renewable).

Northern, Central, and Coastal California will
be able to produce enough electrolytic H2 to
meet in-region daily demand, with excess available
for transport or storage.",
    family = "mont", lineheight = 0.9, hjust = 0, vjust = 1
  ) +
  theme(
    legend.position = "bottom",
    plot.title = element_blank()
  )

#p2_final

# .........................finalize dumbbell plot.........................
p3_final <-
  p3 +
  labs(subtitle = "
       In Southern California, most individual counties will be daily
       net consumers of H2. This means distribution of hydrogen from other
       counties may play an important role. H2 distribution can be one of the
       most costly components of the supply chain, and trucking of liquid H2
       is expected to be the primary mode in 2030. This could also mean that
       Southern California will rely on H2 from other production pathways that
       have a higher environmental footprint than carbon-free electrolytic H2.

       [note: I also plan to add some small annotations on top of the figure to
       point out that Ventura is the only net exporter in SoCal and LA/ SB have
       literally 0 production potential. Also will distinguish this plot and text
       as a callout in the full figure by adding a border around it, coloring
       background, arrow pointing from socal to the box, etc.]") +
  # annotate("text",
  #   x = 0.5, y = 10, label =
  #     "Some annotation",
  #   family = "mont", lineheight = 0.9, hjust = 0, vjust = 1
  # ) +
  theme(
    legend.position = "bottom",
    plot.title = element_blank(),
    plot.subtitle = element_text(family = "mont", hjust = 0),
    aspect.ratio = 0.7
  )

#print(p3_final)
plot <- p2_final | p1_final + plot_layout(widths = c(0.33, 0.66))
print(plot)

## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##                             Combine Components                          ----
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

blank_plot <- ggplot() +
  theme_void()

# plot <- (p2_final | p1_final | (blank_plot/p3_final)) +
#  plot_layout(heights = c(1, 2, 0.5, 0.5), widths = c(0.8,1.25,0.5,0.5))

plot <- (p2_final | p1_final | p3_final) +
  plot_layout(heights = c(1, 1.5, 0.8), widths = c(1, 1, 0.8)) # heights = c(1, 2, 0.5), widths = c(0.8,1.25,0.5)
# print(plot)

plot_final <- plot + plot_annotation(
  title = "How much Hydrogen?",
  caption = "Source: Kristin Art"
) & theme(text = element_text("mont"))

#print(plot_final)
plot_final
# .........................define text components.........................
title <-
  "How much Hydrogen?"

subtitle <-
  "
Both production and demand for hydrogen
fuel (H2) in California are expected to
increase in coming years. Here we explore
estimates for electrolytic H2 supply
and transportation sector demand in 2030.

The transportation sector is expected
to be the earliest adopter for use in
light-, medium-, and heavy-duty fuel
cell electric vehicles (FCEVs). Demand
is concentrated along major highways and
within densely populated neighborhoods.

Production of green H2 through
electrolysis is constrained to areas
with sufficient wind and solar resources,
water availability, and favorable
permitting and regulation policies.

In 2030, Southern California will have the
highest daily demand for H2 in transportation
uses. Southern California will not be able to
supply enough electrolytic H2 to meet its
demand, which means the region may have to rely
on importing (which can be costly) or alternative
sources of H2 (which are not all renewable).

Northern, Central, and Coastal California will
be able to produce enough electrolytic H2 to
meet in-region daily demand, with excess available
for transport or storage."

Reflection

Answer the following questions:

What challenges did you encounter or anticipate encountering as you continue to build / iterate on your visualizations in R?

I found it challenging to figure out what types of graphs look alright together in the same graphic. I made some plot options to see how things might look together, but overall it feels like a lot of info to fit onto one page. I also wasted time on some more complicated plots before deciding to just stick with the simpler visualizations above. It also took a lot of time to adjust and fiddle with all of the plot components and aesthetics.

I expect it will be also take a lot of time to fiddle with the layout of the overall infographic. I anticipate some head-banging to get plot sizes/aspect ratios, text sizes/ layouts, white space/ margins, etc. to look alright… particularly because I don’t have much experience using cowplot, patchwork, annotate, etc.

What ggplot extension tools / packages do you need to use to build your visualizations? Are there any that we haven’t covered in class that you’ll be learning how to use for your visualizations?

I will use patchwork, ggtext, ggpubr, and maybe gridExtra to build the rest of my visualization. I am also using ggpattern, which I don’t believe we’ve covered in class yet. The ggpattern package has pretty good documentation though. I would love to learn about ggrepel during one of our lectures if that’s possible.

What feedback do you need from the instructional team and / or your peers to ensure that your intended message is clear?

I would appreciate some coding tips on how to add/ adjust plot sub-components and whitespace. Like is it possible to overlay a plot slightly over another one using patchwork or do you have to that using an inset instead? Is there a good way to manually specify individual plot height/ width or freeze legend positions in a way that is preserved when combined with other plots? How do you make sure all the text sizes are actually readable when certain plots are smaller or bigger - is it just manual adjustment in each subplot or is there a function to help with that once subplots have been stitched together? Is it easier to set a figure size beforehand to make sure the appearance in the R plot window will be similar to the final saved product; if so, how? What is the best way to save a high quality image? I also saw some good tips in the visualizations from the course resource page, so I will spend some time learning the ways there.

Any recommendations on a better layout are also appreciated, as I am having trouble moving things around to picture it. I have not had a chance to put all the infographic components together neatly, add annotation text/ shapes, and highlight words with colors yet either, fyi.